﻿using Core.SimpleTemp.Common;
using Core.SimpleTemp.Entitys;
using Core.Toolkit.DbInitializer;
using Microsoft.EntityFrameworkCore;
using System;
using System.Collections.Generic;
using System.Text;

namespace Core.SimpleTemp.Repositories.Sys
{
    public class A_SYS_DBinit : DbInitializer

    {
        public A_SYS_DBinit()
        {

        }

        public override void Initialize(DbContext context, WebAppOptions _webAppOptions)
        {

            Menu(context, _webAppOptions);
            context.SaveChanges();
        }

        private void Menu(DbContext context, WebAppOptions _webAppOptions)
        {
            //隐患管理
            var yhglId = Guid.NewGuid();
            context.Set<SysMenu>().Add(new SysMenu
            {
                Id = yhglId,
                Name = "隐患管理",
                Code = "隐患管理",
                SerialNumber = 2,
                Icon = "fa fa-link",
                ParentId = null,

            });

            //隐患排查标准知识库
            var yhglId_yhpcbzzsk = Guid.NewGuid();
            context.Set<SysMenu>().Add(new SysMenu
            {
                Id = yhglId_yhpcbzzsk,
                Name = "隐患排查标准知识库",
                Code = "隐患排查标准知识库",
                SerialNumber = 2,
                Icon = "fa fa-link",
                ParentId = yhglId,//隐患管理

            });


            //操作与相关作业活动
            context.Set<SysMenu>().Add(new SysMenu
            {
                Name = "操作与相关作业活动",
                Code = "操作与相关作业活动",
                SerialNumber = 2,
                Url = "/RisksManagement/StandardKnowledgeBase/OperationsAndActivitiesList.html",
                Icon = "fa fa-link",
                ParentId = yhglId_yhpcbzzsk,//隐患排查标准知识库
            });
            //检查维修作业活动列表
            context.Set<SysMenu>().Add(new SysMenu
            {
                Name = "检查维修作业活动列表",
                Code = "检查维修作业活动列表",
                SerialNumber = 2,
                Url = "/RisksManagement/StandardKnowledgeBase/RepairActivitiesList.html",
                Icon = "fa fa-link",
                ParentId = yhglId_yhpcbzzsk,//隐患排查标准知识库
            });
            //设备设施列表
            context.Set<SysMenu>().Add(new SysMenu
            {
                Name = "设备设施列表",
                Code = "设备设施列表",
                SerialNumber = 2,
                Url = "/RisksManagement/StandardKnowledgeBase/EquipmentFacilitiesList.html",
                Icon = "fa fa-link",
                ParentId = yhglId_yhpcbzzsk,//隐患排查标准知识库
            });
            //工艺介质
            context.Set<SysMenu>().Add(new SysMenu
            {
                Name = "工艺介质",
                Code = "工艺介质",
                SerialNumber = 2,
                Url = "/RisksManagement/StandardKnowledgeBase/ProcessMediumList.html",
                Icon = "fa fa-link",
                ParentId = yhglId_yhpcbzzsk,//隐患排查标准知识库
            });
            //场所环境
            context.Set<SysMenu>().Add(new SysMenu
            {
                Name = "场所环境",
                Code = "场所环境",
                SerialNumber = 2,
                Url = "/RisksManagement/StandardKnowledgeBase/PlaceEnvironmentList.html",
                Icon = "fa fa-link",
                ParentId = yhglId_yhpcbzzsk,//隐患排查标准知识库
            });


        }

    }
}
